package com.example.tellwin.mine.act;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.example.tellwin.AppHelper;
import com.example.tellwin.CallService;
import com.example.tellwin.MainApplication;
import com.example.tellwin.R;
import com.example.tellwin.base.CpBaseActivty;
import com.example.tellwin.common.Common;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class SettingActivity extends CpBaseActivty {

    @BindView(R.id.fee_description_tv)
    TextView feeDescriptionTv;
    @BindView(R.id.help_tv)
    TextView helpTv;
    @BindView(R.id.contact_us_tv)
    TextView contactUsTv;
    @BindView(R.id.feedback_tv)
    TextView feedbackTv;
    @BindView(R.id.logout_tv)
    TextView logoutTv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        ButterKnife.bind(this);
        initViews();
        initEvents();
        initDatas();
    }

    @Override
    protected void initViews() {

    }

    @Override
    protected void initEvents() {

    }

    @Override
    protected void initDatas() {
        setTitle(R.string.setting);
    }

    @OnClick({R.id.fee_description_tv, R.id.help_tv, R.id.contact_us_tv, R.id.logout_tv, R.id.feedback_tv})
    public void onViewClicked(View view) {
        Intent intent = new Intent(this, TextActivity.class);
        switch (view.getId()) {
            case R.id.fee_description_tv:
                intent.putExtra(Common.TYPE, 0);
                startActivity(intent);
                break;
            case R.id.help_tv:
                intent.putExtra(Common.TYPE, 1);
                startActivity(intent);
                break;
            case R.id.contact_us_tv:
                intent.putExtra(Common.TYPE, 2);
                startActivity(intent);
                break;
            case R.id.logout_tv:
                AppHelper.getInstance().clearUser(this);
                AppHelper.getInstance().setUserInfo(null);
                CallService.stop(this);
                for (int i = 0; i < MainApplication.getActivityList().size(); i++) {
                    MainApplication.getActivityList().get(i).finish();
                }
                Intent intent1 = new Intent(SettingActivity.this, LoginRegisterActivity.class);
                startActivity(intent1);
                break;
            case R.id.feedback_tv:
                Intent intent2 = new Intent(this , FeedBackActivity.class);
                startActivity(intent2);
                break;

        }
    }
}
